Skip to content

fleet-proxy(http): no-body responses (HEAD/204/304) and 1xx handling (#5921) - #5922

Merged
dezren39 merged 2 commits into
mainfrom
queue/9819-5921-http-nobody-responses
Nov 5, 2026
Merged

dezren39 merged 2 commits into
mainfrom
queue/9819-5921-http-nobody-responses

Conversation

@dezren39

@dezren39 dezren39 commented Nov 5, 2026 •

Copy link
Copy Markdown
Member

Fixes #5921 · queue task 9819

What

HttpConn::request in pkgs/fleet/crates/fleet-proxy/src/http.rs decided the response body solely from the framing headers, never from the request method or the status class:

  • A response to a HEAD request, and any 204 / 304 response, was read for exactly Content-Length bytes that by definition never arrive — stalling the exchange until the 660 s tunnel read timeout, killing the pooled connection, and repeating on the broker's fresh-tunnel retry. A 304 may legitimately carry the Content-Length of the cached 200, so this is not a malformed-peer case.
  • A 1xx interim response (e.g. 103 Early Hints) was returned as the final answer, leaving the real response in the stream to desync the next exchange on the pooled connection.

Change

Tests

Reproduced first: pre-fix, the new 103→200 pinning test failed with the interim status returned as final (left: 103, right: 200); the no-body shapes hang pre-fix, as the laptop probe in #5921 documented.

New canned-peer tests in http.rs: HEAD with CL, 204 with CL, 304 with the cached CL, 204 with chunked Transfer-Encoding, and a 103→200 sequence — each followed by a clean second exchange on the same pooled connection, plus the ordinary 200 control still passing.

  • Laptop: cargo test -p fleet-proxy --lib — 33 passed, 0 failed
  • Laptop: cargo fmt -p fleet-proxy -- --check — clean

…5921)

HttpConn::request decided the response body solely from the framing headers: a HEAD, 204, or 304 response carrying a Content-Length was read as if body bytes followed (stalling until the 660s tunnel read timeout and killing the pooled connection), and a 1xx interim response was returned as the final answer, leaving the real response in the stream to desync the next pooled exchange.

Body existence is now decided from the request method and status class before the framing headers (RFC 9112 section 6.3): HEAD responses and 101/204/304 are body-less regardless of Content-Length or Transfer-Encoding, and 1xx interim responses (except 101) are consumed while the reader continues to the final response. The status/header parse moves into read_response_head so each head in a 1xx sequence gets the same #5579 strict Content-Length validation, which is unchanged for responses that do carry bodies.

Pinning canned-peer tests cover HEAD with CL, 204 with CL, 304 with the cached CL, 204 with chunked Transfer-Encoding, and a 103-then-200 sequence, each followed by a clean second exchange on the pooled connection. cargo test -p fleet-proxy --lib: 32 passed. Queue task 9819.
@dezren39
dezren39 requested a review from a team as a code owner November 5, 2026 02:42
@coderabbitai

coderabbitai Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 25 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: fbcef1a2-bda0-4100-84e0-6e4e5754986e
Commits

Reviewing files that changed from the base of the PR and between 83f78ed and f2b83b6.

Files selected for processing: 1

  • pkgs/fleet/crates/fleet-proxy/src/http.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-05T02:49:52.975085Z f2b83b6 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 56b855b74b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

// timeout and kill the connection; skipping them leaves
// the stream exactly at the next response, so a keep-alive
// exchange stays reusable.
let no_body = method.eq_ignore_ascii_case("HEAD") || matches!(status, 101 | 204 | 304);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Match the HEAD method case-sensitively

For a request whose method is head or Head, this skips a response body even though HTTP methods are case-sensitive and the request method is transmitted unchanged. These tokens pass parse_request; for example, the queue broker's non-POST branch (queue_broker.rs:644–645) returns a 405 with a JSON body. That body now remains unread while Broker::do_request returns the connection to the pool, causing an empty-body JSON error for this request and desynchronizing the next exchange. Use method == "HEAD" so only an actual HEAD request suppresses body reads.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f2b83b6 — thank you. The comparison is now method == "HEAD" exactly (HTTP methods are case-sensitive; only an actual HEAD suppresses the body read), with the reason recorded in the comment at the site. Pinned by the new canned-peer test lowercase_head_is_a_different_method_and_reads_its_body: a lowercase head response carrying a Content-Length body is read in full and the connection stays reusable. cargo test -p fleet-proxy --lib: 33 passed.

Codex review finding on PR #5922: HTTP methods are case-sensitive, so eq_ignore_ascii_case("HEAD") would also suppress the body read for a lowercase head request — a different method whose response does carry a body, which would then desync the pooled connection. Compare method == "HEAD" exactly, and pin it with a canned-peer test: a lowercase head response with a Content-Length body is read in full and the connection stays reusable. cargo test -p fleet-proxy --lib: 33 passed.
@dezren39
dezren39 merged commit 9ddf6a8 into main Nov 5, 2026
1 check passed
@dezren39
dezren39 deleted the queue/9819-5921-http-nobody-responses branch November 5, 2026 03:14
@dezren39
dezren39 restored the queue/9819-5921-http-nobody-responses branch November 8, 2026 04:29
@dezren39
dezren39 deleted the queue/9819-5921-http-nobody-responses branch November 8, 2026 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fleet-proxy(http): response reader waits for a body that never comes on HEAD / 204 / 304, and treats 1xx as the final response

1 participant